package xiaohu.day8.HJ90;

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String strIp = sc.nextLine();
        String[] ips = strIp.split("\\.");
        if (ips.length != 4) {
            System.out.println("NO");
            return;
        } else {
            for (String ip : ips) {
                if (ip == null || ip.equals("")) {
                    System.out.println("NO");
                    return;
                }
                int num = Integer.parseInt(ip);
                if (num < 0 || num > 255) {
                    System.out.println("NO");
                    return;
                } else if (ip.length() != String.valueOf(num).length()) {
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("YES");
    }
}